package network;

import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;
import java.util.Map;

public class UdpEchoDictServer extends UdpEchoServer{
    private Map<String,String> dictionary = new HashMap<>();

    public UdpEchoDictServer(int port) throws SocketException {
        super(port);
        dictionary.put("cat","小猫");
        dictionary.put("dog","杨鑫正");
        dictionary.put("fuck","凸(艹皿艹 )");
    }

    @Override
    public String process(String s) {
        return dictionary.getOrDefault(s,"词典中没有这个单词哦!");
    }

    public static void main(String[] args) throws IOException {
        UdpEchoDictServer dictServer = new UdpEchoDictServer(9090);
        dictServer.start();
    }

}
